//
//  ViewController.m
//  享元模式
//
//  Created by flannery on 2018/12/18.
//  Copyright © 2018年 flannery. All rights reserved.
//

#import "ViewController.h"
#import "Shape.h"
#import "ShapeFactory.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSArray *array = [NSArray arrayWithObjects:@"Red", @"Green", @"Blue", @"White", @"Black" ,nil];
    
    for (int i=0; i < 20; ++i) {
        NSString *key = [array objectAtIndex:arc4random()%5];
        Circle *circle = [ShapeFactory getCircle:key];
        [circle setX:arc4random() % 100];
        [circle setY:arc4random() % 100];
        [circle setRadius:100];
        [circle draw];
    }
}


@end
